<?php
include '../config/auth.php';

function success(){
    $result=[
        'error'=>'0',
        'message'=>'成功'
    ];
    return json_encode($result);
}

function error($msg){
    $data=[
        'error'=>'1',
        'message'=>$msg
    ];
    return json_encode($data);
}
$room_id=$_POST['room_id'];
$config = include '../config/db.php';
$db = new PDO($config['dsn'],$config['username'],$config['password']);
$statement=$db->prepare('select * from make_room where room_id=:room_id');
$statement->execute([':room_id'=>$room_id]);
$user=$statement->fetch();
if(empty($user)){
    die(error('房间号不存在！请自行创建'));
}else{
    echo success();
}